From cf8daf7dd3a66084dfafdde1d9bf9d0d94fe42a7 Mon Sep 17 00:00:00 2001
From: "HATEC\\SPVDEV001" <tri.susilo@altama.co.id>
Date: Fri, 15 Sep 2023 08:42:46 +0700
Subject: migrasi get detail dari odoo ke solr

---
 src/pages/shop/product/[slug].jsx | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

(limited to 'src/pages/shop/product/[slug].jsx')

diff --git a/src/pages/shop/product/[slug].jsx b/src/pages/shop/product/[slug].jsx
index 5d706dec..af20413f 100644
--- a/src/pages/shop/product/[slug].jsx
+++ b/src/pages/shop/product/[slug].jsx
@@ -6,6 +6,7 @@ import PageNotFound from '@/pages/404'
 import dynamic from 'next/dynamic'
 import { useRouter } from 'next/router'
 import cookie from 'cookie'
+import axios from 'axios'
 
 const BasicLayout = dynamic(() => import('@/core/components/layouts/BasicLayout'))
 const Product = dynamic(() => import('@/lib/product/components/Product/Product'))
@@ -17,7 +18,12 @@ export async function getServerSideProps(context) {
   const auth = cookieObj.auth ? JSON.parse(cookieObj.auth) : {}
   const authToken = auth?.token || ''
 
-  let product = await productApi({ id: getIdFromSlug(slug), headers: { Token: authToken } })
+  let response = await axios(
+    `${process.env.NEXT_PUBLIC_SELF_HOST}/api/shop/product-detail?id=`+getIdFromSlug(slug)
+  )
+  let product = response.data
+  // let productSolr = await productApi({ id: getIdFromSlug(slug), headers: { Token: authToken } })
+  // let productSolr = null
   if (product?.length == 1) {
     product = product[0]
     const regexHtmlTags = /(<([^>]+)>)/gi
@@ -35,7 +41,7 @@ export async function getServerSideProps(context) {
   }
 }
 
-export default function ProductDetail({ product }) {
+export default function ProductDetail({ product}) {
   const router = useRouter()
 
   if (!product) return <PageNotFound />
-- 
cgit v1.2.3

